home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / rodent_3.arc / RODENT.TXT < prev    next >
Text File  |  1991-04-28  |  6KB  |  141 lines

  1.    This program (these programs?) is adapted from the mouse demo
  2. program published in PC Magazine.  It continuously displays the
  3. mouse cursor location and state of the mouse buttons until the
  4. user clicks the left button in the "Quit" box.
  5.  
  6.    A variety of techniques were used in the various
  7. implementations; the C versions and Turbo Pascal version use a
  8. separate procedure for each mouse function, the QuickBasic
  9. version uses a single generic mouse procedure in which the
  10. desired function is one of the arguments passed to the
  11. procedure, and the Turbo Basic version does all the mouse stuff inline.
  12. The Quick Pascal version uses the Mouse unit.
  13.  
  14.    The Turbo C and Turbo Pascal versions both require that the
  15. file CGA.BGI exists in the current directory at runtime.  The
  16. Quick Basic version requires the files QB.BI and QB.QLB if run
  17. in the integrated development environment, and requires the
  18. files QB.BI and QB.LIB to compile.  Both C versions require the
  19. STDIO.H, DOS.H, and GRAPH.H (Microsoft) or GRAPHICS.H (Borland)
  20. header files.  The Quick Pascal version requires the MSGraph and
  21. Mouse units (The Mouse unit is supplied with the Quick Pascal
  22. package in source form).  The Turbo Pascal version requires the
  23. Dos and Graph units.  The Turbo Basic version is a complete
  24. standalone.
  25.  
  26.    I undoubtedly could have done a better job of commenting the
  27. code, but I think there's enough info in there to allow you to
  28. write your own routines using these mouse functions.  Rather
  29. than try to explain all the arcane PEEKs, VARPTRs, and DEF SEG's
  30. in the Turbo Basic version, I refer you to the Turbo Basic
  31. manual particularly the sections on assembly interfacing and the
  32. description of the REGS statement/function.
  33.  
  34.    All mouse functions are called via interrupt 33(hex) with the
  35. function number in the AX register.  The other processor
  36. registers are used to pass various arguments both to and from
  37. the function.  Here's a list of the functions the program uses :
  38.  
  39. Mouse Reset and Status
  40. Input : AX = 0
  41. Output: AX = -1 if mouse hardware & driver installed, else 0
  42.         BX = number of mouse buttons
  43.  
  44. Show Cursor
  45. Input  : AX = 1
  46. Output : None
  47.  
  48. Hide Cursor
  49. Input  : AX = 2
  50. Output : None
  51.  
  52. Get Button Status and Information
  53. Input  : AX = 3
  54. Output : BX = button status (1 = left, 2 = right, and 4 =center.
  55.               If more than one button is pressed, the sum will
  56.               be returned (ie, both left and right = 3).
  57.          CX = horizontal coordinate of current mouse location
  58.          DX = vertical coordinate of current mouse location.
  59.  
  60. Set Graphics Cursor Block
  61. Input  : AX = 9
  62.          BX = Horizontal cursor hot spot
  63.          CX = vertical cursor hot spot
  64.          DX = offset address of cursor mask (32-word table)
  65.          ES = segment address of cursor mask
  66.  
  67.    The hot spot is the single point where the cursor is
  68. considered to be, relative to the upper left corner of the
  69. graphic cursor.  I used a hot spot of 7, 7 in the hourglass
  70. cursor; this places it in the center of the cursor (where the
  71. lines cross).  Try changing this value and move the cursor to
  72. the corners of the screen to see what happens.  The range of
  73. hotspot values is -127 to +128.
  74.  
  75.    Here's a few other useful mouse functions :
  76.  
  77. Set Cursor Position
  78. Moves the mouse cursor to the specified location.
  79. Input  : AX = 4
  80.          BX = horizontal cursor position
  81.          CX = vertical cursor position
  82. Output : None
  83.  
  84. Get Button Press Info
  85. Returns the number of times a button was pressed since the last
  86. call to function 5.
  87. Input  : AX = 5
  88.          BX = which button to interrogate (0 = left, 1 = right)
  89. Output : AX = button status of all buttons, same format as
  90.               function 3.
  91.          BX = number of presses for requested button
  92.          CX = horizontal cursor position at last button press
  93.          DX = vertical cursor position at last button press
  94.  
  95. Get Button Release Info
  96. Returns the number of times a button was released since the last
  97. call to function 6.
  98. Input  : AX = 6
  99.          BX = which button to interrogate
  100. Output : AX = button status of all buttons
  101.          BX = number of releases for requested button
  102.          CX = horizontal cursor position at last button press
  103.          DX = vertical cursor position at last button press
  104.  
  105. Set Min and Max Horizontal Position
  106. Restricts horizontal cursor movement to specified area.
  107. Input  : AX = 7
  108.          CX = Minimum horizontal position
  109.          DX = Maximum horizontal position
  110. Output : None
  111.  
  112. Set Min and Max Vertical Position
  113. Restricts vertical cursor movement to specified area.
  114. Input  : AX = 8
  115.          CX = Minimum vertical position
  116.          DX = Maximum vertical position
  117.  
  118. Set Text Mode Cursor
  119. Sets mask values for text mode cursor.
  120. Input  : AX = 10
  121.          BX = Cursor select (0 = software cursor, 1 = hardware cursor)
  122.          CX = Screen mask (software) or scan line start (hardware)
  123.          DX = Cursor mask (software) or scan line stop (hardware)
  124. Output : None
  125. The screen location (both attribute byte and character) is ANDed
  126. with the screen mask and XORed with the cursor mask, if software
  127. cursor.  I don't believe anybody uses the hardware cursor which
  128. is similar to the normal text cursor.
  129.  
  130.    There are a total of 30-odd mouse functions for such things
  131. as light-pen emulation; setting, removing, and saving interrupts
  132. for movement and button presses; and mouse speed/sensitivity
  133. control.  See the Microsoft Mouse Programmer's Reference,
  134. published by Microsoft Press, for more information.
  135.  
  136.    Note that it is generally a good idea to hide the mouse cursor
  137. before an output to the screen which might cause the screen to
  138. scroll and show it afterwards.  Try moving the text cursor to
  139. the bottom line of the screen (LOCATE 25, 1; GotoXY 25, 1; etc)
  140. and print several linefeeds to see what happens to the mouse cursor.
  141.